using System;
using System.Collections.Generic;
using System.Text;
using JsonHTTPHandler;
using DemoJSONService.ObjectLibrary;

namespace DemoJSONService
{
  [JsonService]
  public class Service
  {
    [JsonMethod]
    public Customer GetCustomer()
    {
      Customer customer = new Customer();
      customer.FirstName = "Freddy";
      customer.LastName = "Mercury";
      return customer;
    }

    [JsonMethod]
    public Customer GetCustomer(int customerID)
    {
      Customer customer = new Customer();
      customer.FirstName = "First name of " + customerID;
      customer.LastName = "Last name of " + customerID;
      return customer;
    }

    [JsonMethod]
    public Customer UpdateCustomer(int customerID, string phoneNumber, decimal moneyBalance)
    {
      Customer customer = new Customer();
      customer.Account = new Account();
      customer.Account.Balance = moneyBalance;
      customer.FirstName = "First name of " + customerID;
      customer.LastName = "Last name of " + customerID;
      customer.PhoneNumber = phoneNumber;
      return customer;
    }

    [JsonMethod]
    public Customer GetCustomerWithError()
    {
      throw new Exception("Throwing an error from Service.GetCustomerWithError");
    }
  }
}
